Preview - Constructing A Simple Model: Solid Diffusion

Implementing the Go Procedure


Here is one way to write pseudo-code for a go procedure in the Diffusion model:

At each tick:

  • If I am an empty patch (lattice site), I ask one of the neighboring atoms to move here. 

It may seem strange to have empty lattice sites be the active agents here as opposed to the atoms, but there is at least one good reason to do it this way: it is computationally more efficient to have each patch check if it is empty than to have each atom check if any of its neighboring patches are empty. The latter option would result in many patches getting checked multiple times. Furthermore, it is totally reasonable to think about vacancies moving around the lattice.


Questions

Please answer the questions below.

Implement a Go procedure in NetLogo code based on the pseudo-code. You can use the pseudo-code above, or if yours is different and you think it is better, use that. When you have it working, copy your code here.

 

Here are some commands you may find useful:  with, not, any?, turtles-here, one-of, turtles-on, neighbors4, nobody, move-to, myself. Look them up in the Programming Guide if you don't know what they do.


If you had any issues on this page, describe them below. If not, type something like "no problems" and continue on.


Notes

These notes will appear on every page in this lesson so feel free to put anything here you'd like to keep track of.